#ifndef _GAME_H_
#define _GAME_H_

#include "Piece.h";
#include <vector>

//enum MoveState { VALID, INVALID, CHECK, CHECKMATE };

typedef Piece *PiecePtr;

class Game
{
private:
	position enpasant;
	string castling;

	Piece* last; // captured piece
	char* lastmove;
	int halfmove; // Won't be use
	int fullmove; // Won't be use
	void RedoMove();
	void SetPiece(int i, int j, char c);
	//MoveState Check(char * mv);
	bool isAttacked(int x, int y, Color col); 
	bool isValidMove(int fromx, int fromy, int tox, int toy, PieceType tp);

	//MoveState CheckKing(char * mv);
	//MoveState CheckQueen(char * mv);
	//MoveState CheckRook(char * mv);
	//MoveState CheckKnight(char * mv);
	//MoveState CheckBishop(char * mv);
	//MoveState CheckPawn(char * mv);

public:
	bool myTurn;
	char* InitFEN;
	Color myCol; // My color
	std::vector<Piece> capturedW; // Captured white piece
	std::vector<Piece> capturedB; // Captured black piece
	bool isChecked;

	PiecePtr board[10][10]; // Chess board
	Game(); // Standard constructor
	Game(Color c); // Constructor with my color.
	void LoadGame();
	void SaveGame(); // Save game
	void Init(); // Game init
	int Move(char* mv); // Move piece
	void StartGame(); //Start game after init
	void SetGame(char * FEN); // set game.
	bool isCheckMated(int x, int y);
};

#endif